import { defineConfig, loadEnv } from 'vite'
import viteBaseConfig from './viteBaseConfig.ts';
import viteDevConfig from './vite.dev.config.ts';
import viteProdConfig from './vite.prod.config.ts';


const envResolver = {
  'serve': () => { return {...viteBaseConfig, ...viteDevConfig}},
  'build': () => { return {...viteBaseConfig, ...viteProdConfig}}
}


// https://vite.dev/config/
export default defineConfig(({ command, mode }) => {
    console.log('mode---', mode);
    console.log('command---', command);
    loadEnv(mode, process.cwd(), '');
    return envResolver[command]();
})
